]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Replace monkey-patched method with Symbol.iterator
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 19 May 2020 19:29:49 +0000 (21:29 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 19 May 2020 19:33:31 +0000 (21:33 +0200)
This allows using the actor itself as iterator:

  for (let child of container)
      doStuff(child);

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1269

js/ui/environment.js

index 44a92db3613e2550612bd019672fff6891ce2751..a0b884eb3e49ca2ac4aa98cddac01a4579461bb2 100644 (file)
@@ -285,7 +285,7 @@ function init() {
         _easeActorProperty(this, 'value', target, params);
     };
 
-    Clutter.Actor.prototype.iterate_children = function* () {
+    Clutter.Actor.prototype[Symbol.iterator] = function* () {
         for (let c = this.get_first_child(); c; c = c.get_next_sibling())
             yield c;
     };